Raids are possible because you don't need to own a city to transfer commodities, you only need to be in the city's square (Recall you don't own a city until you occupied for a whole turn). So, if you notice an enemy has left a city open and you've got a ship or a dragon rider in range, you can go into the city, transfer all commodities out of the city onto your units, and leave. Your opponent may not even know what happened (you may have to assure him it's not a bug).